package com.rxmvp.rxmvpdemo.global;

import android.app.Application;

import com.rxmvp.rxmvpdemo.RxRetrofit.NetApi;
import com.rxmvp.rxmvpdemo.RxRetrofit.RetrofitClient;
import com.rxmvp.rxmvpdemo.RxRetrofit.RxRetrofitUtils;

import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;
import retrofit2.Retrofit;

/**
 * 作者： huangRZ on 2017/1/21. 15:04
 * 邮箱：917647409@qq.com
 */
@Module
public class NetModule {

    @Singleton
    @Provides
    public Retrofit createRetrofit(Application application){
        return RetrofitClient.getInstance().createClient(application);
    }

    @Singleton
    @Provides
    public NetApi createNetApi(Retrofit retrofit){
        return retrofit.create(NetApi.class);
    }

    @Singleton
    @Provides
    public RxRetrofitUtils createRxRetrofit(){
        return new RxRetrofitUtils();
    }

}
